<template>
  <div>
    <nav-bar>
      <template v-slot:left>
        <div class="back" @click="back">
          <img
            class="back-img"
            src="~@/assets/images/icon/back/fanhui_1.png"
            alt=""
          />
        </div>
      </template>
      <template v-slot:center>
        <div class="search">
          <img
            class="search-icon"
            src="~@/assets/images/icon/search.png"
            alt=""
          />
          <input class="search-input" type="text" placeholder="搜索" />
        </div>
      </template>
    </nav-bar>
  </div>
</template>

<script>
import { defineComponent } from "vue";
import NavBar from "@/components/navbar/NavBar.vue";
import { useRouter } from "vue-router";

export default defineComponent({
  components: {
    NavBar,
  },
  setup() {
    const router = useRouter();

    const back = () => {
      router.back(-1);
    };

    return {
      back,
    };
  },
});
</script>

<style scoped lang='less'>
.back {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .back-img {
    width: 50%;
    max-width: 20px;
    max-height: 20px;
  }
}

.search {
  width: 80%;
  height: 40%;
  display: flex;
  align-items: center;
  background-color: #f4f5f5;
  border-radius: 5% / 50%;
  overflow: hidden;
  font-weight: 400;
  font-size: 12px;
  .search-input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0 5px;
    background-color: #f4f5f5;
    line-height: 100%;
  }
  .search-icon {
    height: 75%;
    width: auto;
    margin-left: 5px;
    margin-right: 2px;
  }
}
</style>
